package com.teach.shape1;

import java.util.Scanner;

/**
 * 圆形
 * @author J.L.Zhou
 *	jlzhou.top 版权所有
 */
public class Roundness {
	private static final String NAME = "圆形";
	/**
	 * 宽
	 */
	private float r;

	
	/**
	 * 周长
	 */
	private float perimeter;
	
	/**
	 * 面积
	 */
	private float area;

	public void input(Scanner sc) {
		System.out.println("输入"+NAME+"的半径: ");
		r = sc.nextFloat();

	
		
		perimeter = (float)(2*Math.PI*r);
		area = (float)(Math.PI*r*r);
	}
	

	/**
	 * 获取周长
	 * @return 周长
	 */
	public float getPerimeter(){
		return perimeter;
	}

	/**
	 * 获取面积
	 * @return
	 */
	public float getArea(){
		return area;
	}

	/**
	 * 打印基本信息
	 */
	public void show() {
		System.out.format("%s\t周长：%.2f\t面积：%.2f\t半径：%.2f\n",NAME,perimeter,area,r);
	}

	
	public float getR() {
		return r;
	}


	public void setR(float r) {
		this.r = r;
	}


	public static void main(String[] args) {
		Roundness rectangle = new Roundness();
		rectangle.input(new Scanner(System.in));
		rectangle.show();
	}

}
